package com.es.core.service;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 描述:
 * Old-AgeCareSystem-
 *
 * @author Derek
 * @create 2021-12-09 9:51
 */
@Service
public class RabbitMQService {

    @Autowired
    private RabbitTemplate rabbitTemplate;

    public String sendMessage(String message){
        //排队买东西  78887 xxx  削峰
        //rabbitTemplate.s
        rabbitTemplate.convertAndSend("boot-queue",message);
        return "ok";
    }


    public String sendMessage(String exchangeName,String routingkey,String message){
        rabbitTemplate.convertAndSend(exchangeName,routingkey,message);
        return "ok";
    }

    public String sendSMS(String msg){
        rabbitTemplate.convertAndSend("sms-exchange","sms-q-ex-key",msg);
        return "ok";
    }
}
